import copy

class BaseComponentView(object):
    __guid__ = 'cef.BaseComponentView'
    __COMPONENT_CLASS_BY_ID__ = {}

    @staticmethod
    def RegisterComponent(componentClass):
        BaseComponentView.__COMPONENT_CLASS_BY_ID__[componentClass.__COMPONENT_ID__] = componentClass


    __COMPONENT_ID__ = const.zentity.INVALID_COMPONENT_ID
    __COMPONENT_DISPLAY_NAME__ = 'INVALID NAME'
    __COMPONENT_CODE_NAME__ = 'INVALID'
    __OPTIONAL_INITIAL_VALUE_DATA__ = {}
    __MANDATORY_INITIAL_VALUE_DATA__ = {}
    __DYNAMIC_INITIAL_VALUE_DATA__ = {}

    @staticmethod
    def GetComponentClassByID(componentID):
        return BaseComponentView.__COMPONENT_CLASS_BY_ID__.get(componentID)



    @staticmethod
    def GetComponentLookupDict():
        return copy.deepcopy(BaseComponentView.__COMPONENT_CLASS_BY_ID__)



    @classmethod
    def GetAllStaticParameterNames(cls):
        retSet = set(cls.__MANDATORY_INITIAL_VALUE_DATA__.keys())
        retSet.update(cls.__OPTIONAL_INITIAL_VALUE_DATA__.keys())
        return retSet



    @classmethod
    def GetMandatoryParameterNames(cls):
        return cls.__MANDATORY_INITIAL_VALUE_DATA__.keys()



    @classmethod
    def GetPythonTypeForParameter(cls, initialValueName):
        data = const.zentity.COMPONENTDATA_INVALID_TYPE
        if (initialValueName in cls.__MANDATORY_INITIAL_VALUE_DATA__):
            data = cls.__MANDATORY_INITIAL_VALUE_DATA__[initialValueName]
        elif (initialValueName in cls.__OPTIONAL_INITIAL_VALUE_DATA__):
            data = cls.__OPTIONAL_INITIAL_VALUE_DATA__[initialValueName]
        dataType = const.zentity.COMPONENTDATA_TYPE_TO_PYTHON_TYPE_MAP[data]
        return dataType




